<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : cart.xsl
    Created on : November 26, 2012, 2:13 PM
    Author     : kenisk
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="/">
        <xsl:for-each select="Products/Product">
            <div id="itemCart">
                <img class="imgCart">
                    <xsl:attribute name="src">
                        <xsl:value-of select="ProductImage"/>
                    </xsl:attribute>
                </img>
                <div class="dollar">
                    <xsl:value-of select="ProductPrice"/>
                    <xsl:value-of select="'$'"/>
                </div>
                <input type="text" class="inputQuan" onkeydown="return validateDigits(event)">
                    <xsl:attribute name="value">
                        <xsl:value-of select="ProductQty"/>
                    </xsl:attribute>
                    <xsl:attribute name="id">
                        <xsl:value-of select="'Quan'"/>
                        <xsl:value-of select="ProductID"/>
                    </xsl:attribute>
                </input>
                <input type="submit" value="Edit" class="edtButton">
                    <xsl:attribute name="onclick">
                        <xsl:value-of select="'changeQty('"/>
                        <xsl:value-of select="ProductID"/>
                        <xsl:value-of select="','"/>
                        <xsl:value-of select="ProductPrice"/>
                        <xsl:value-of select="')'"/>
                    </xsl:attribute>
                    <xsl:value-of select="'Edit'"/>
                </input>
                <div class="dollar">
                    <xsl:value-of select="Subtotal"/>
                    <xsl:value-of select="' .$'"/>
                </div>
            </div>
        </xsl:for-each>
        <div class="dollar" id="totalAmount">
            <xsl:text>Total Amount: </xsl:text>
            <xsl:text>$</xsl:text>
            <xsl:value-of select="sum(Products/Product/Subtotal)"/>
            <xsl:text> USD</xsl:text>
        </div>
        <input type="submit" value="Checkout" class="edtButton">
            <xsl:attribute name="onclick">
                <xsl:value-of select="'CheckOut()'"/>
            </xsl:attribute>
            <xsl:value-of select="'Checkout'"/>
        </input>
        <input type="submit" value="ContinueShopping" class="edtButton">
            <xsl:attribute name="onclick">
                <xsl:value-of select="'ContinueShopping()'"/>
            </xsl:attribute>
            <xsl:value-of select="'ContinueShopping'"/>
        </input>
    </xsl:template>

</xsl:stylesheet>
